#include <iostream>
#include <algorithm>
using namespace std;
int n, r[100001], num[100001], sum[100001], cnt = 1, mi;
signed main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i ++)
        cin >> r[i];
    sort(r + 1, r + n + 1);
    for (int i = 1; i <= n; i ++) {
        if (i != 1 && r[i] != r[i - 1])
            num[++ cnt] ++;
        else num[cnt] ++;
    }
    sum[1] = num[1];
    for (int i = 2; i <= n; i ++)
        sum[i] = sum[i - 1] + num[i];
    for (int i = 1; i <= cnt; i ++)
        mi += min(num[i], sum[n] - sum[i]);
    cout << n - mi << "\n";
    return 0;
}